#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
const int N = 1e6 + 10, M = 2e3 + 10;
int a[N];
int b[N];
int main()
{
    int n, m;
    int kind = 0;
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    int left = 1, right = 1;
    int ret = n;
    int begin = 1;
    while (right <= n)
    {
        if (b[a[right]]++ == 0)
        {
            kind++;
        }
        while (kind == m)
        {
            if (ret > right - left + 1)
            {
                ret = right - left + 1;
                begin = left;
            }
            if (b[a[left]]-- == 1)
            {
                kind--;
            }
            left++;
        }
        right++;
    }
    cout << begin << ' ' << begin + ret - 1;

    return 0;
}